package com.jc.ds.model;

import java.util.Date;

/**
 * user
 * @author 
 */
public class User extends BaseValueObject {
    private Long id;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 密码
     */
    private String passWord;

    /**
     * 真实姓名
     */
    private String name;

    /**
     * 是否冻结   normal 非冻结   lock 锁定
     */
    private String isEnable;

    /**
     * 是否删除
     */
    private Integer isDelete;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建人用户ID
     */
    private Long creator;

    /**
     * 创建人姓名
     */
    private String creatorName;

    /**
     * 盐
     */
    private String salt;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIsEnable() {
        return isEnable;
    }

    public void setIsEnable(String isEnable) {
        this.isEnable = isEnable;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getCreator() {
        return creator;
    }

    public void setCreator(Long creator) {
        this.creator = creator;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByUserName(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by user_name asc";
            }else{
                this.orderStr = this.orderStr + ",user_name asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by user_name desc";
            }else{
                this.orderStr = this.orderStr + ",user_name desc";
            }
        }
    }

    public void orderByPassWord(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by pass_word asc";
            }else{
                this.orderStr = this.orderStr + ",pass_word asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by pass_word desc";
            }else{
                this.orderStr = this.orderStr + ",pass_word desc";
            }
        }
    }

    public void orderByName(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by name asc";
            }else{
                this.orderStr = this.orderStr + ",name asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by name desc";
            }else{
                this.orderStr = this.orderStr + ",name desc";
            }
        }
    }

    public void orderByIsEnable(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_enable asc";
            }else{
                this.orderStr = this.orderStr + ",is_enable asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_enable desc";
            }else{
                this.orderStr = this.orderStr + ",is_enable desc";
            }
        }
    }

    public void orderByIsDelete(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_delete asc";
            }else{
                this.orderStr = this.orderStr + ",is_delete asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_delete desc";
            }else{
                this.orderStr = this.orderStr + ",is_delete desc";
            }
        }
    }

    public void orderByCreateTime(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by create_time asc";
            }else{
                this.orderStr = this.orderStr + ",create_time asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by create_time desc";
            }else{
                this.orderStr = this.orderStr + ",create_time desc";
            }
        }
    }

    public void orderByCreator(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by creator asc";
            }else{
                this.orderStr = this.orderStr + ",creator asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by creator desc";
            }else{
                this.orderStr = this.orderStr + ",creator desc";
            }
        }
    }

    public void orderByCreatorName(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by creator_name asc";
            }else{
                this.orderStr = this.orderStr + ",creator_name asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by creator_name desc";
            }else{
                this.orderStr = this.orderStr + ",creator_name desc";
            }
        }
    }

    public void orderBySalt(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by salt asc";
            }else{
                this.orderStr = this.orderStr + ",salt asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by salt desc";
            }else{
                this.orderStr = this.orderStr + ",salt desc";
            }
        }
    }
}